<?php

namespace admin\controller;
class log extends _base
{
    public function __construct()
    {
        parent::__construct();
        $this->assign('m','sys');
    }

    /**
     * @Notes:列表
     * @Interface lists
     * @author: LZH
     * @Time: 2019/6/18   17:30
     */
    public function log_login()
    {
        $this->assign('y','log_login');
        $aParams = array();
        //标题
        if ($admin_name = I('admin_name')) {
            $aParams['where']['admin_name LIKE'] = "%{$admin_name}%";
        }
        //筛选开始时间
        if(I('starttime') && I('starttime') !='1970-01-01 08:00:00'){
            $aParams['where']['creation_date >='] = strtotime(I('starttime'));
        }
        //筛选结束时间
        if(I('endtime') && I('endtime') !='1970-01-01 08:00:00'){
            $aParams['where']['creation_date <='] = strtotime(I('endtime'));
        }

        $aParams['field'] = ['login_id', 'admin_name', 'login_ip', 'creation_date'];
        $aParams['page'] = max(1, intval(I('page')));
        $aData = M('log_login')->page($aParams);

        $this->display('log/log_login',['aData'=>$aData]);
    }

    /**
     * @Notes:列表
     * @Interface lists
     * @author: LZH
     * @Time: 2019/6/18   17:30
     */
    public function log_acts()
    {
        $this->assign('y','log_acts');
        $aParams = array();
        //标题
        if ($content = I('content')) {
            $aParams['where']['content LIKE'] = "%{$content}%";
        }
        //筛选开始时间
        if(I('starttime') && I('starttime') !='1970-01-01 08:00:00'){
            $aParams['where']['creation_date >='] = strtotime(I('starttime'));
        }
        //筛选结束时间
        if(I('endtime') && I('endtime') !='1970-01-01 08:00:00'){
            $aParams['where']['creation_date <='] = strtotime(I('endtime'));
        }

        $aParams['page'] = max(1, intval(I('page')));
        $aData = M('log_act')->page($aParams);

        $this->display('log/log_act',['aData'=>$aData]);
    }



}

